#ifndef DATACOLLECT_H
#define DATACOLLECT_H

#include <iostream>
#include <vector>
#include <stdio.h>
using namespace std;

#include "SerialPort.h"
#include "DataBase.h"
#include "InfoContainer.h"
#include "TemperatureSensor_SCUT.h"
#include "DevCreater.h"

class CDataBase;

class CDataCollect
{
public:
    CDataCollect();
    ~CDataCollect();
    bool Init();
    void Run(int & CollectFlag, int & TerminalFlag, pthread_mutex_t & ComLock);
    void Cleanup();

private:
    bool GetCmd();  //根据具体的传感器获取具体命令，并将其存到SensorCmd里
    void DataPicker(int & CollectFlag, int & TerminalFlag, pthread_mutex_t & ComLock);  //用于数据采集
    void DataAnalyse();//int SensorType);
    void SaveData();

private:

    CSerialPort *SerialPort;
    CInfoContainer *InfoContainer;   
    CTool * Tool;
    CDataBase *DataBase;
    CDevCreater * DevCreater;

    vector <string> SensorCmd;
    vector <string> ReturnData;
    vector <struct CachedData> SensorData;
    int PreTime;
};

#endif // DATACOLLECT_H
